

    \filetitle{array}{Insert array with user data}{report/array}

	\paragraph{Syntax}

\begin{verbatim}
P.array(Caption,Data)
\end{verbatim}

\paragraph{Input arguments}

\begin{itemize}
\item
  \texttt{P} {[} struct {]} - Report object created by the
  \href{report/new}{\texttt{report.new}} function.
\item
  \texttt{Caption} {[} char \textbar{} cellstr {]} - Title or a cell
  array with title and subtitle displayed at the top of the array; see
  Description for splitting the title or subtitle into multiple lines.
\item
  \texttt{Data} {[} cell {]} - Cell array with input data; numeric and
  text entries are allowed.
\end{itemize}

\paragraph{Options}

\begin{itemize}
\item
  \texttt{\textquotesingle{}arrayStretch=\textquotesingle{}} {[} numeric
  \textbar{} \emph{\texttt{1.15}} {]} - (Inherited) Stretch between
  lines in the array (in pts).
\item
  \texttt{\textquotesingle{}captionTypeface=\textquotesingle{}} {[}
  cellstr \textbar{} char \textbar{}
  \emph{\texttt{\textquotesingle{}\textbackslash{}large\textbackslash{}bfseries\textquotesingle{}}}
  {]} - (Inherited) \LaTeX~format commands for typesetting the array
  caption; the subcaption format can be entered as the second cell in a
  cell array.
\item
  \texttt{\textquotesingle{}colWidth=\textquotesingle{}} {[} numeric
  \textbar{} \emph{\texttt{NaN}} {]} - (Inheritable from parent objects)
  Width, or a vector of widhts, of the array columns in
  \texttt{em}units; \texttt{NaN} means the width of the column will
  adjust automatically.
\item
  \texttt{\textquotesingle{}format=\textquotesingle{}} {[} char
  \textbar{} \emph{\texttt{\textquotesingle{}\%.2f\textquotesingle{}}}
  {]} - (Inherited) Numeric format string; see help on the built-in
  \texttt{sprintf} function.
\item
  \texttt{\textquotesingle{}footnote=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - (Inherited) Footnote at the array title;
  only shows if the title is non-empty.
\item
  \texttt{\textquotesingle{}heading=\textquotesingle{}} {[} char
  \textbar{} cellstr \textbar{} \emph{empty} {]} - (Inherited)
  User-supplied heading, i.e.~an extra row or rows at the top of the
  array. The heading can be either a \LaTeX~code, or a cell array whose
  size is consistent with \texttt{Data}. The heading is repeated at the
  top of each new page when used with
  \texttt{\textquotesingle{}long=\textquotesingle{}\ true}.
\item
  \texttt{\textquotesingle{}inf=\textquotesingle{}} {[} char \textbar{}
  \emph{\texttt{\textquotesingle{}\$\textbackslash{}infty\$\textquotesingle{}}}
  {]} - (Inherited) \LaTeX~string that will be used to typeset
  \texttt{Inf}s.
\item
  \texttt{\textquotesingle{}long=\textquotesingle{}} {[} \texttt{true}
  \textbar{} \emph{\texttt{false}} {]} - (Inherited) If \texttt{true},
  the array may stretch over more than one page.
\item
  \texttt{\textquotesingle{}longFoot=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - (Inherited) Footnote that appears at the
  bottom of the array (if it is longer than one page) on each page
  except the last one; works only with
  \texttt{\textquotesingle{}long=\textquotesingle{}} \texttt{true}.
\item
  \texttt{\textquotesingle{}longFootPosition=\textquotesingle{}} {[}
  \texttt{\textquotesingle{}centre\textquotesingle{}} \textbar{}
  \emph{\texttt{\textquotesingle{}left\textquotesingle{}}} \textbar{}
  \texttt{\textquotesingle{}right\textquotesingle{}} {]} - (Inherited)
  Horizontal alignment of the footnote in long arrays; works only with
  \texttt{\textquotesingle{}long=\textquotesingle{}} \texttt{true}.
\item
  \texttt{\textquotesingle{}nan=\textquotesingle{}} {[} char \textbar{}
  \emph{\texttt{\textquotesingle{}\$\textbackslash{}cdots\$\textquotesingle{}}}
  {]} - (Inherited) \LaTeX~string that will be used to typeset
  \texttt{NaN}s.
\item
  \texttt{\textquotesingle{}pureZero=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - (Inherited) \LaTeX~string that will be
  used to typeset pure zero entries; if empty the zeros will be printed
  using the current numeric format.
\item
  \texttt{\textquotesingle{}printedZero=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - (Inherited) \LaTeX~string that will be
  used to typeset the entries that would appear as zero under the
  current numeric format used; if empty these numbers will be printed
  using the current numeric format.
\item
  \texttt{\textquotesingle{}separator=\textquotesingle{}} {[} char
  \textbar{}
  \emph{\texttt{\textquotesingle{}\textbackslash{}medskip\textbackslash{}par\textquotesingle{}}}
  {]} - (Inherited) \LaTeX\\
  commands that will be inserted after the array.
\item
  \texttt{\textquotesingle{}sideways=\textquotesingle{}} {[}
  \texttt{true} \textbar{} \emph{\texttt{false}} {]} - (Inherited) Print
  the array rotated by 90 degrees.
\item
  \texttt{\textquotesingle{}tabcolsep=\textquotesingle{}} {[}
  \texttt{NaN} \textbar{} numeric {]} - (Inherited) Space between
  columns in the array, measured in em units; \texttt{NaN} means the
  \LaTeX~default.
\item
  \texttt{\textquotesingle{}typeface=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - (Not inherited) \LaTeX~code specifying
  the typeface for the array as a whole; it must use the declarative
  forms (such as \texttt{\textbackslash{}itshape}) and not the command
  forms (such as \texttt{\textbackslash{}textit\{...\}}).
\end{itemize}

\paragraph{Generic options}

See help on \href{report/Contents}{generic options} in report objects.

\paragraph{Description}

The input cell array \texttt{Data} can contain either strings or numeric
values, or horizontal rules. Numeric values are printed using the
standard \texttt{sprintf} function and formatted using the
\texttt{\textquotesingle{}format=\textquotesingle{}} option. Horizontal
rules must be entered as a string of five (or more) dashes,
\texttt{\textquotesingle{}-\/-\/-\/-\/-\textquotesingle{}}, in the first
cell of the respective row, with all other cells empty in that row. If
you wish to include a \LaTeX~command or a piece of \LaTeX~code, you must
enclose it in curly brackets.

\subparagraph{Titles and subtitles}

The input argument \texttt{Caption} can be either a text string, or a
1-by-2 cell array of strings. In the latter case, the first cell will be
printed as a title, and the second cell will be printed as a subtitle.

To split the title or subtitle into multiple lines, use the following
LaTeX commands wrapped in curly brackets:
\texttt{\{\textbackslash{}\textbackslash{}\}} or
\texttt{\{\textbackslash{}\textbackslash{}{[}Xpt{]}\}}, where \texttt{X}
is the width of an extra vertical space (in points) added between the
respective lines.

\paragraph{Example}

These commands create a table with two rows separated by a horizontal
rule, and three columns in each of them. The middle columns will have
Greek letters printed in \LaTeX~math mode.

\begin{verbatim}
x = report.new();

A = { ...
    'First row','{\$\textbackslash alpha\$}',10000; ...
    '-----','',''; ...
    'Second row','{\$\textbackslash beta\$}',20000; ...
};

x.array('My Table',A);

x.publish('test1.pdf');

open test1.pdf;
\end{verbatim}

\paragraph{Example}

Use the option \texttt{\textquotesingle{}inputFormat=\textquotesingle{}}
to change the way the input strings are interpreted. Compare the two
tables in the resulting PDF.

\begin{verbatim}
x = report.new();

A = { ...
    1,2,3; ...
    '$\alpha$','b','c', ...
    };

x.array('Table with Plain Input Format (Default)',A, ...
    'heading=',{'A','B','$\Gamma$';'-----','',''});

x.array('Table with LaTeX Input Format',A, ...
    'heading=',{'A','B','$\Gamma$';'-----','',''}, ...
    'inputFormat=','latex');

x.publish('test2.pdf');

open test2.pdf;
\end{verbatim}


